home *** CD-ROM | disk | FTP | other *** search
- MODULE 'intuition/intuition'
-
- CONST BUFSIZE=GADGETSIZE*7, IFLAGS=IDCMP_CLOSEWINDOW+IDCMP_GADGETUP
-
- DEF buf[BUFSIZE]:ARRAY,next,w:PTR TO window,gadid,gad:PTR TO gadget,
- msg:PTR TO intuimessage,port,class
-
- PROC main()
- next:=Gadget(buf,NIL,1,0,20,20,100, 'Set DTR')
- next:=Gadget(next,buf,2,0,20,35,100, 'Set RTS')
- next:=Gadget(next,buf,3,0,20,50,100, 'Clear DTR')
- next:=Gadget(next,buf,4,0,20,65,100, 'Clear RTS')
- next:=Gadget(next,buf,7,0,20,80,100, 'DTR <> RTS')
- next:=Gadget(next,buf,5,0,140,65,100,'Toggle DTR')
- next:=Gadget(next,buf,6,0,140,80,100,'Toggle RTS')
- IF w:=OpenW(20,11,300,100,IFLAGS,$F,'NULL Modem Tester',NIL,1,buf)
- Box(140,20,180,40,2) ; Box(190,20,230,40,2)
- Colour(1,0)
- TextF(150,50,'DSR') ; TextF(200,50,'CTS')
- port:=w.userport
- LOOP
- IF (msg:=GetMsg(port))<>NIL
- class:=msg.class ; gad:=msg.iaddress ; gadid:=gad.userdata
- ReplyMsg(msg)
- SELECT class
- CASE IDCMP_GADGETUP
- SELECT gadid
- CASE 1
- BSET #7,$BFD000 /* Set DTR */
- CASE 2
- BSET #6,$BFD000 /* Set RTS */
- CASE 3
- BCLR #7,$BFD000 /* Clear DTR */
- CASE 4
- BCLR #6,$BFD000 /* Clear RTS */
- CASE 5
- REPEAT
- BSET #7,$BFD000 /* Set DTR */
- Delay(25)
- BCLR #7,$BFD000 /* Cleat DTR */
- Delay(25)
- UNTIL Mouse()=1
- CASE 6
- REPEAT
- BSET #6,$BFD000 /* Set RTS */
- Delay(25)
- BCLR #6,$BFD000 /* Clear RTS */
- Delay(25)
- UNTIL Mouse()=1
- CASE 7
- REPEAT
- BSET #6,$BFD000 /* Set RTS */
- Delay(25)
- BCLR #6,$BFD000 /* Clear RTS */
- BSET #7,$BFD000 /* Set DTR */
- Delay(25)
- BCLR #7,$BFD000 /* Clear DTR */
- UNTIL Mouse()=1
- ENDSELECT
- CASE IDCMP_CLOSEWINDOW
- JUMP exitpr
- ENDSELECT
- ENDIF
-
- BTST #3,$BFD000 /* Check DSR */
- BNE dsron
- Box(140,20,180,40,2) /* White box */
- BRA dsroff
- dsron: Box(140,20,180,40,3) /* Red box */
- dsroff: BTST #4,$BFD000 /* Check CTS */
- BNE ctson
- Box(190,20,230,40,2) /* White box */
- BRA ctsoff
- ctson: Box(190,20,230,40,3) /* Red box */
- ctsoff:
- ENDLOOP
- exitpr:
- CloseW(w)
- ENDIF
- ENDPROC
-
-